import { ref } from 'vue'

export function useBackgroundImage() {
  const imageLoaded = ref(false)
  const imageError = ref(false)
  
  const primaryImageUrl = 'https://objectstorageapi.bja.sealos.run/g6rnmc1y-mymy/hero-bg.jpg'
  const fallbackImageUrl = 'https://objectstorageapi.bja.sealos.run/g6rnmc1y-yunshang/wan_ip/123.jpg'
  
  const currentImageUrl = ref(primaryImageUrl)
  
  const handleImageLoad = () => {
    imageLoaded.value = true
  }
  
  const handleImageError = () => {
    imageError.value = true
    currentImageUrl.value = fallbackImageUrl
  }
  
  return {
    imageLoaded,
    imageError,
    currentImageUrl,
    handleImageLoad,
    handleImageError
  }
} 